// @门派功能
const express = require('express');
const router = express.Router();
const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');
const keys = require('../../config/keys');
const passport = require('passport');
const School = require('../../models/Schools/School');

// @route  GET api/school/
// @desc   返回的请求的json数据
// @access public
router.get('/', (req, res) => {
    res.json({ msg: 'school works' });
});

// @route  GET api/goods/types/get
// @desc   获取物品类型信息
// @access Private

router.get(
    '/get',
    passport.authenticate('jwt', { session: false }),
    (req, res) => {
        School.find()
        .then(school => {
          if (!school) {
            return res.status(404).json('没有任何内容');
          }
          res.json(school);
        })
        .catch(err => res.status(404).json(err));
    }
);
  

module.exports = router;
  